<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI教育助手</title>
    <style>
        :root {
            --primary-color: #3498db;
            --secondary-color: #2c3e50;
            --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: #333;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f5f5f5;
        }
        
        .header {
            text-align: center;
            margin-bottom: 40px;
        }
        
        .logo-container {
            margin-bottom: 20px;
        }
        
        .logo img {
            width: 100px;
            height: 100px;
        }
        
        .container {
            background-color: white;
            border-radius: 10px;
            padding: 30px;
            box-shadow: 0 0 20px rgba(0,0,0,0.1);
        }
        
        .features {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }
        
        .feature-card {
            background: rgba(255, 255, 255, 0.9);
            border-radius: 15px;
            padding: 25px;
            box-shadow: var(--shadow);
            text-align: center;
            transition: transform 0.3s ease;
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
        }
        
        .feature-card h3 {
            color: var(--secondary-color);
            margin-bottom: 15px;
            font-size: 1.5rem;
        }
        
        .feature-card p {
            color: #666;
            margin-bottom: 20px;
        }
        
        .feature-icon {
            font-size: 48px;
            margin-bottom: 15px;
        }
        
        .btn {
            display: inline-block;
            padding: 10px 20px;
            background-color: var(--primary-color);
            color: white;
            text-decoration: none;
            border-radius: 5px;
            transition: background-color 0.3s ease;
        }
        
        .btn:hover {
            background-color: #2980b9;
        }
        
        .chat-container {
            background: rgba(255, 255, 255, 0.9);
            border-radius: 15px;
            padding: 25px;
            box-shadow: var(--shadow);
            margin-bottom: 30px;
        }
        
        .chat-header {
            text-align: center;
            margin-bottom: 20px;
        }
        
        .chat-header h2 {
            color: var(--secondary-color);
            font-size: 1.8rem;
        }
        
        .chat-messages {
            height: 300px;
            overflow-y: auto;
            border: 1px solid #ddd;
            border-radius: 10px;
            padding: 15px;
            margin-bottom: 20px;
            background-color: #fff;
        }
        
        .message {
            margin-bottom: 15px;
            padding: 10px;
            border-radius: 8px;
        }
        
        .user-message {
            background-color: #e3f2fd;
            margin-left: 20%;
        }
        
        .ai-message {
            background-color: #f5f5f5;
            margin-right: 20%;
        }
        
        .message-header {
            font-weight: bold;
            margin-bottom: 5px;
        }
        
        .chat-input {
            display: flex;
            gap: 10px;
        }
        
        .chat-input input {
            flex: 1;
            padding: 12px;
            border: 1px solid #ddd;
            border-radius: 5px;
            font-size: 16px;
        }
        
        .chat-input button {
            padding: 12px 20px;
            background-color: var(--primary-color);
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
            transition: background-color 0.3s ease;
        }
        
        .chat-input button:hover {
            background-color: #2980b9;
        }
        
        .footer {
            text-align: center;
            margin-top: 30px;
            padding: 20px;
            color: #666;
        }
    </style>
</head>
<body>
    <div class="header">
        <div class="logo-container">
            <div class="logo">
                <img src="../static/images/ai_learning.svg" alt="AI教育助手Logo">
            </div>
        </div>
        <h1>AI教育助手</h1>
        <p>智能学习平台，为您提供个性化的学习体验</p>
    </div>
    
    <div class="container">
        <div class="features">
            <div class="feature-card">
                <div class="feature-icon">💬</div>
                <h3>智能问答</h3>
                <p>基于知识库的智能问答系统，快速解答您的学习疑问</p>
                <a href="#" class="btn" id="qaBtn">开始问答</a>
            </div>
            
            <div class="feature-card">
                <div class="feature-icon">📚</div>
                <h3>学习路径推荐</h3>
                <p>根据您的学习情况和兴趣，推荐个性化学习路径</p>
                <a href="#" class="btn" id="recommendBtn">获取推荐</a>
            </div>
            
            <div class="feature-card">
                <div class="feature-icon">📄</div>
                <h3>文档处理</h3>
                <p>上传并处理文档，自动构建知识库</p>
                <a href="../document_upload" class="btn">上传文档</a>
            </div>
        </div>
        
        <div class="chat-container">
            <div class="chat-header">
                <h2>知识问答</h2>
            </div>
            <div class="chat-messages" id="chatMessages">
                <div class="message ai-message">
                    <div class="message-header">AI助手</div>
                    <div class="message-content">您好！我是您的AI学习助手，有什么问题我可以帮您解答吗？</div>
                </div>
            </div>
            <div class="chat-input">
                <input type="text" id="userInput" placeholder="请输入您的问题...">
                <button id="sendBtn">发送</button>
            </div>
        </div>
    </div>
    
    <div class="footer">
        <p>&copy; 2025 AI教育助手 - 智能学习平台</p>
    </div>

    <script>
        // 页面元素
        const chatMessages = document.getElementById('chatMessages');
        const userInput = document.getElementById('userInput');
        const sendBtn = document.getElementById('sendBtn');
        const qaBtn = document.getElementById('qaBtn');
        const recommendBtn = document.getElementById('recommendBtn');
        
        // 发送消息功能
        sendBtn.addEventListener('click', sendMessage);
        userInput.addEventListener('keypress', function(e) {
            if (e.key === 'Enter') {
                sendMessage();
            }
        });
        
        // 功能按钮事件
        qaBtn.addEventListener('click', function(e) {
            e.preventDefault();
            alert('问答功能已激活，请在下方输入框中输入您的问题');
            userInput.focus();
        });
        
        recommendBtn.addEventListener('click', function(e) {
            e.preventDefault();
            alert('学习路径推荐功能需要您提供更多信息，请等待后续功能更新');
        });
        
        function sendMessage() {
            const message = userInput.value.trim();
            if (!message) return;
            
            // 添加用户消息到聊天窗口
            addMessageToChat(message, 'user');
            userInput.value = '';
            
            // 模拟AI回复
            setTimeout(() => {
                addMessageToChat('这是一个模拟回复。在实际应用中，系统会根据您的问题和知识库内容生成准确的回答。', 'ai');
            }, 1000);
        }
        
        function addMessageToChat(content, sender) {
            const messageDiv = document.createElement('div');
            messageDiv.className = `message ${sender}-message`;
            
            const headerDiv = document.createElement('div');
            headerDiv.className = 'message-header';
            headerDiv.textContent = sender === 'user' ? '您' : 'AI助手';
            
            const contentDiv = document.createElement('div');
            contentDiv.className = 'message-content';
            contentDiv.textContent = content;
            
            messageDiv.appendChild(headerDiv);
            messageDiv.appendChild(contentDiv);
            
            chatMessages.appendChild(messageDiv);
            
            // 滚动到底部
            chatMessages.scrollTop = chatMessages.scrollHeight;
        }
    </script>
</body>
</html>